package com.cy.sc.service;

import com.cy.sc.pojo.Staff;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

import java.util.List;

/**
 * <br>@class: StaffClientService
 * <br>@description: Feign远程方法映射
 * <br>@author: cy
 * <br>@date: 2020-04-02 14:16:46
 * <br>@version: 1.0
 * <br>
 * <br>@since: (版本) 作者 时间 注释
 */
@Component
@FeignClient(value = "HYSTRIX-SERVICE-STAFF", fallbackFactory = StaffClientServiceFallbackFactory.class)//需要Feign做映射的Eureka中注册的服务名称
public interface StaffClientService {
    //注意方法 访问的远程URL一定要一致，参数一致，方法名称可自定义
    @GetMapping("/staff/get/{id}")
    public Staff queryById(@PathVariable("id") long id);

    @GetMapping("/staff/list")
    public List<Staff> queryAll();

    @PostMapping("/staff/add")
    public boolean addStaff(Staff staff);

}
